import React, { Component } from 'react';
import axios from 'axios';

class App extends Component {

  getData = ()=>{
    axios.get("").then(
      response =>{
        console.log("请求成功", response.data);
      },
      error =>{
        console.log("请求失败", error)
      },
    )
  }

  render() {
    return (
      <div>
        <button onClick={this.getData}>获取数据</button>
      </div>
    );
  }
}

export default App;